@import url(./iconfont/iconfont.css);
:root {
  --bg-color:#fff;
  --side-bg-color:#fafbfc;
  --shadow-color:rgba(0,0,0,.1);
  --header-height:56px;
  --left-side-width:248px;
  --left-side-base-width:248px;
  --left-side-min-width:200px;
  --left-side-max-width:528px;
}
body,header,nav,main,aside,h1,ul {
  margin: 0; 
  padding: 0;
}
header {
  width: 100%;
  height: var(--header-height);
  line-height: 56px;
  display: flex;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  padding: 0 12px;
  background-color: var(--bg-color);
  box-shadow: 0 0 15px var(--shadow-color);
  z-index: 2;
}
div.container {
  display: flex;
  width: 100%;
  height: calc(100vh - var(--header-height));
  margin-top: var(--header-height);
  overflow: hidden;
}
aside {
  width: var(--left-side-width);
  left: var(--aside-left);
  max-width: var(--left-side-max-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  background-color: var(--side-bg-color);
  box-shadow: 0 0 15px var(--shadow-color);
}
.transition {
  transition: width .2s ease;
}

.side-bar {
  width: 24px;
  height: calc(100vh - var(--header-height));
  position: absolute;
  top: var(--header-height);
  left: var(--left-side-width);
  cursor: ew-resize;
  z-index: 2;
}
/* 拖拽控制条 start */
.side-bar .resize-bar {
  width: 2px;
  height: 100%;
  background-color: #e5e5e5;
  transition: background-color .2s ease-in-out;
}
.side-bar:hover .resize-bar {
  background-color: blue;
}
.side-bar:active .resize-bar {
  background-color: blue;
  box-shadow: 0 0 15px var(--shadow-color);
}
/* 拖拽控制条 end */
/* 开关按钮 start */
.switch-bar {
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  position: absolute;
  top: 60px;
  left: -12px;
  border-radius: 50%;
  box-shadow: 0 0 12px var(--shadow-color);
  color: blue;
  background-color: var(--bg-color);
  transition: all .2s ease;
  opacity: 0;
  cursor: pointer;
}
.switch-bar .switch-display {
  width: 48px;
  height: 48px;
  /* background-color: rgba(0,0,0,.5); */
  position: absolute;
  top: -12px;
  left: -12px;
}
.side-bar:hover .switch-bar:hover {
  color: #fff;
  background-color: blue;
  opacity: 1;
}
.side-bar:hover .switch-bar:hover + .resize-bar {
  background-color: #e5e5e5;
}
aside:hover + .side-bar .switch-bar,
.side-bar:hover .switch-bar {
  opacity: 1;
}
/* 开关按钮 end */
/* 导航样式 start */
aside nav {
  width: var(--left-side-width);
  min-width: var(--left-side-min-width);
  position: sticky;
  left: 0;
  top: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  box-sizing: border-box;
  transition: none;
}
aside nav ul {
  list-style: none;
}
aside nav ul li {
  height: 40px;
  line-height: 40px;
  border-radius: 8px;
  transition: background-color .2s;
  cursor: pointer;
  padding:  0 16px;
}
aside nav ul li:hover {
  background-color: #e6effc;
}
/* 导航样式 end */
/* 菜单收起状态 start */
aside.collapse + .side-bar .switch-bar {
  opacity: 1;
}
aside.collapse + .side-bar {
  cursor: default;
}
aside.collapse + .side-bar:hover .resize-bar {
  background-color: #e5e5e5;
}
aside.collapse nav {
  visibility: hidden;
}
aside.collapse:hover nav{
  width: var(--left-side-base-width);
  background-color: var(--side-bg-color);
  transition: all .3s;
  z-index: 2;
  visibility: visible;
}
aside.collapse:hover + .side-bar {
  left: var(--left-side-base-width);
  transition: all .3s;
}
/* 改成同级无法在hover展开时菜单时点击展开按钮，先隐藏 */
aside.collapse:hover + .side-bar .switch-bar {
  opacity: 0;
}
/* 菜单收起状态 end */
main {
  flex: 1;
  padding: 24px 36px;
  overflow: hidden auto;
  background-color: var(--bg-color);
  z-index: 1;
}
